package com.yu.dao;

import java.util.List;

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yu.pojo.Tcount;

public class TcountDao {
	public Tcount getTcountByNum(int num) {
		if(num>=0&&num<6) {
			String num1 = num*10+"";
			String num2 = (num+1)*10+"";
			String sqlString = "select count(*) as count from thuiyuan where uage >= ? and uage < ?";
			List list = DH.getall(sqlString, new Tcount(), new String[] {num1, num2});
			if(list.size()>0) {
				return (Tcount)list.get(0);
			}
			return null;
		}else {
			String num1 = num*10+"";
			String sqlString = "select count(*) as count from thuiyuan where uage>= ?";
			List list = DH.getall(sqlString, new Tcount(), new String[] {num1});
			if(list.size()>0) {
				return (Tcount)list.get(0);
			}
			return null;
		}

	}
	public Tcount getallhuiyuan() {
		String sqlString = "select count(*) as count from thuiyuan";
		List list = DH.getall(sqlString, new Tcount(), new String[] {});
		return (Tcount)list.get(0);
	}
	
}

